package com.dmm.vod.controller;


import com.dmm.result.Result;
import com.dmm.vod.service.VideoVisitorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.coyote.Request;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 视频来访者记录表 前端控制器
 * </p>
 *
 * @author dmm
 * @since 2022-09-11
 */
@Api(tags ="VideoVisitor管理")
@RestController
@RequestMapping(value="/vod/videoVisitor")
@CrossOrigin
public class VideoVisitorController {

    @Autowired
    private VideoVisitorService videoVisitorService;


    //课程数据统计
    @ApiOperation("显示统计数据")
    @GetMapping("findCount/{courseId}/{startDate}/{endDate}")
    public Result showChart(
            @ApiParam("开始时间") @PathVariable Long courseId,
            @ApiParam("开始时间") @PathVariable String startDate,
            @ApiParam("结束时间") @PathVariable String endDate){

        Map<String, Object> map = videoVisitorService.findCount(courseId, startDate, endDate);
        return Result.success(map);
    }
    //没有bug但是前端不太会还是用上面的把
    //课程数据统计
//    @ApiOperation("显示统计数据")
//    @PostMapping("findCount/{courseId}")
//    public Result showChart(
//            @ApiParam("开始时间") @PathVariable Long courseId,
//                            @ApiParam("开始时间") @RequestBody String startDate,
//                            @ApiParam("结束时间") @RequestBody String endDate){
//        Map<String, Object> map = videoVisitorService.findCount(courseId, startDate, endDate);
//        return Result.success(map);
//    }


}

